# coding: utf-8
import os
import sys

from PySide6.QtCore import Qt, QLocale
from PySide6.QtWidgets import QApplication
from qfluentwidgets import FluentTranslator

from common import cfg
from views import MainWindow

# 启用dpi刻度
if cfg.get(cfg.dpiScale) != "Auto":
    os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "0"
    os.environ["QT_SCALE_FACTOR"] = str(cfg.get(cfg.dpiScale))

# create application
app = QApplication(sys.argv)
app.setAttribute(Qt.ApplicationAttribute.AA_DontCreateNativeWidgetSiblings)

locale = QLocale(QLocale.Language.Chinese, QLocale.Country.China)
translator = FluentTranslator(locale)
app.installTranslator(translator)

# create main window
w = MainWindow()
w.show()

sys.exit(app.exec())
